package com.qfedu.springmvc.controller;


import com.qfedu.springmvc.entity.ListUser;
import com.qfedu.springmvc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Arrays;
import java.util.List;

@Controller
public class HelloSpringMvc {

    @RequestMapping("/hello")
    public String hello(){
        System.out.println("AAAA");
        return "index";
    }

    @RequestMapping("/test1")
    public String test1(Integer id , String name){
        System.out.println("id:" + id + ",name:" + name);
        return "index";
    }

    @RequestMapping("/test2")
    public String test2(User user){
        System.out.println(user);
        return "index";
    }
    @RequestMapping("/array")
    public String array(String [] name){
        System.out.println(Arrays.toString(name));
        return "index";
    }

    @RequestMapping("/list")
    public String list(@RequestParam List<String> name){
        System.out.println(name);
        return "index";
    }

    @RequestMapping("/listUser")
    public String ListUser(ListUser listUser){
        System.out.println(listUser.getUser());
        return "index";
    }


    @RequestMapping("/listUser/{id}")
    public String ListUser(@PathVariable("id") Integer id){
        System.out.println(id);
        return "index";
    }

}
